home *** CD-ROM | disk | FTP | other *** search
- (*<<<>>>*)
-
-
- (*******************************************************************)
- (**) (**)
- (**) PROGRAM ZINDENT ; (**)
- (**) (**)
- (*******************************************************************)
-
- CONST
-
- SysTitle =
- 'zINDENT.PAS, v. 7.D, Indent for dBASE / Turbo Pascal Source Files';
-
- SysVersion1 = 'Command via : Line / File / User';
-
- SysVersion2 = 'MSDOS version 0300pm, mon, 30.Mar.87, Glen Ellis';
-
- SysCredit = 'Apple/CPM and MSDOS tested. ';
-
- SysPgmName = 'ZINDLIST.DAT'; (* file containing filename list *)
-
- SysCpuSpeed = 2 ; (* author's writing/developmental system is 2 MHz ! *)
-
- (* parameters FOR Compiler *)
- {$C+}
- {$U+} (* $U+ User Interrupt benchmarks almost same as $U- *)
- {$F4}
-
- (* parameters FOR LISTT.PAS, Borland's advanced Lister program *)
- {.U+}
- {.N-}
- {.P-}
- {.PO0}
-
-
- (*####################################################################*)
-
- (*$I c:zinVAR.INC*) (* for core program *)
- (*$I C:zinSTR.INC*) (* required string utilties *)
- (*$I C:zinSCR.INC*) (* screen display procedures *)
- (*$I C:zinDOC.INC*) (* system documentation / readme.inc *)
- (* C:ZReadme.INC*) (* not Pascal include file *)
- (*$I C:zinUTL.INC*) (* miscelaneous procedures *)
- (*$I C:zinDSK.INC*) (* disk file procedures *)
- (*$I C:zinKEYDB.INC*) (* keyword dBASE *)
- (*$I C:zinKEYTP.INC*) (* keyword Pascal *)
-
-
- (********************************************************************)
-
-
- BEGIN (* MAIN *)
-
- (*=======> INIT <=======*)
-
- (* programmer's options *)
-
- SysDisplay := true ; (* always true *)
-
- SysUserTrace := true ; (* normal : display program path *)
-
- SysPgmTrace := false ; (* audit developmental path *)
-
- SysSpcTrace := false ; (* special, temporary *)
-
- (* name/function of procedure *) (* located in this file *)
- (* *) (* *)
- pSayHeader; (* Display header *) (* SysScr.inc *)
-
- IF not SysPgmTrace then pDelay2;
-
- (*=======> FETCH <=======*)
-
- (* initz *)
- SysPgmMod := ' ' ;
-
- (* fetch command line from either paramstring or paramfile
- (* set defaults for operational vars :
- (* Filename, Indent, Comment, LineCount, Vertiate
- *)
-
- (* set mode flags true *)
- (* ZinLine.Inc will re-assign *)
- SysCmdLine := true ; (* enable Command Line Parse *)
- SysCmdFile := false; (* file names via text file *)
- SysCmdUser := false; (* direct keyboard entry *)
-
- (* parameter flags : if satisfied, then lower flag *)
- SysCmdUserFile := false ; (* filename fetch *)
- SysCmdUserParm := false ; (* parameter fetch *)
-
- (*=======> FETCH LINE ENTRY *)
-
- IF SysCmdLine then
- begin
-
- IF SysPgmTrace then
- begin
- writeln; writeln;
- writeln('--> SysCmdLINE');
- pDelay1;
- end;
-
- (*$I c:zinLINE.INC*) (*:::*)
-
- (* if user entered no command line, or requested Docs, then *)
- (* pause while he reads header *)
- If (SysInFileName = '?') then
- begin
- writeln; writeln;
- writeln('User Entry / Documentation has been enabled . . . .');
- pKeyPressed;
- end;
-
- end;
-
- (*=======> FETCH FILE ENTRY *)
-
- IF SysCmdFile then
- begin
- IF SysPgmTrace then
- begin
- writeln('---> SysCmdFILE');
- pDelay1;
- end;
- SysInFileName := SysPgmName; (* read data file name *)
- (*$I c:zinFILE.INC*) (*:::*)
- end;
-
- (*=======> FETCH USER ENTRY *)
-
- IF ( (SysCmdUser) and (SysCmdUserFile) )
- or
- ( (SysCmdUser) and (SysCmdUserparm) )
- then
- begin
- IF SysPgmTrace then
- begin
- writeln('---> SysCmdUSER');
- pDelay1;
- end;
- (*$I c:zinUSER.INC*) (*:::*)
- end;
-
- (*=======> CORE CONTROLLER <=======*)
-
- (* if filename and parameters installed *)
- IF (SysCmdLine) or (SysCmdFile) or (SysCmdUser)
- then SysEnableCORE := true
- ELSE SysEnableCORE := false;
-
- IF SysUserTrace then (* display list of file names *)
- begin
- writeln('SysUserTrace enabled');
- pSayFileList; (*::: SysUtl.INC *)
- end;
-
- IF SysPgmTrace then
- begin
- pSaySysVar; (* big VAR display prior to CORE *)
- end;
-
- (*=======> CORE <=======*)
-
- IF SysEnableCore then
- begin
-
- IF SysPgmTrace then
- begin
- writeln('--- Enable Core ---');
- pDelay1;
- end;
-
- (* init : cmdline/cmdfile/cmduser *)
- IF (SysInSourceMax = 0)
- then SysInSourceMax := 1;
-
- (*=========================================*)
- FOR SysInSourceCnt := 1 to SysInSourceMax do
- begin (* Count Through InSource Array of FileNames *)
-
- (* fetch new filename *)
- (* parse for .typ *)
- (* start file *)
- (* read loop *)
-
- (* load the carrier memvar *)
- SysInFileName := SysInSource[SysInSourceCnt];
-
- writeln('FileName : ', SysInFileName,' :');
- pDelay1;
-
- (*=======> Parse file.typ for mode : OL, DB, TP *)
-
- (*:::*)
- (* can be preset (forced) by user in SysUser.Inc. *)
- (* default entry is ' '. *)
-
- if (SysPgmMod = ' ') then
- begin
-
- pSysParse( SysInFileName, SysPgmMod, SPMSL, SPMSR );
- (*::: SysDsk.INC *)
-
- (* IF SysPgmTrace then *)
- (* begin *)
- writeln('Results of FileName Parse :',SysPgmMod,':');
- pDelay1;
- (* end; *)
-
- end;
-
- (*=======> Start Files *)
-
- (* create three file.type vars for .BAK, .(source), .$$$
- (* Open, Reset, Rewrite files *)
- IF SysPgmTrace then
- begin
- writeln;
- writeln('--- Start Files ---');
- pDelay1;
- end;
-
- SysIOcheck := true ; (* any one dead file will skip loop one time ! *)
-
- pSysStartFiles(SysIOcheck); (*::: SysUtl.INC *)
-
- (*---------------*)
- IF SysIOcheck then
- begin
-
- IF SysUserTrace then
- begin
- writeln;
- writeln('--- Start Read Loop --- ',SysInFileName);
- pDelay1;
- end;
-
- (* prep for linecnt during WHILE loop *)
- SysLineNum := 0;
-
- (* operational var set to zero *)
- pSysLvlInit; (*::: SysUtl.INC *)
-
- (*=======> Scan Through File *)
-
- WHILE not (eof(SysInFile))
- do
- begin
-
- (* read text line from input file *)
- readln(SysInFile,SysInLine);
-
- (* assign output string to value read in *)
- SysOutLine := SysInLine;
-
- (* writing parms are long for indentifiability *)
- (* procedure parms are small so line will be < 127 *)
-
- (* update short vars *)
- pSysVarShortUPdt; (*::: SysUtl.INC *)
-
- (*===================================================
- (*
- (* current KeyWord module application flow:
- (*
- (* identify KEYWORD, and adjust indent
- (* SysUserTrace start/stop of structures
- (* toggle sysmarkwrite
- (* OutSTR = exit line
- (* indentPOS = current left margin position
- (* indentNUM = actual indent group length
- (* lineMAX = max length of text line = 79
- (* markWRITE = enable comments write to disk
- (**)
-
- (*
- (* Indent for dBASE-II
- (**)
-
- IF SysPgmMod = 'DB'
- then
- pKEYDB( SOLL, SIP, SIN, SLM, SMW, SLI, SLC, SLW);
- (*::: KeyDB.INC*)
-
- (*
- (* Indent for Turbo Pascal
- (**)
-
- IF SysPgmMod = 'TP'
- then
- pKEYTP( SOLL, SIP, SIN, SLM, SMW, SEB, SLB );
- (*::: KeyTP.INC*)
-
- (* next application
- (* find string in file system , write to single file
- (* application in Treefile
- (* pFIND( RefStr, FndStr, fndcnt );*)
-
- (* update long vars *)
- pSysVarLongUpdt; (*::: SysUtl.INC *)
-
- (* line count prefixer, handled in STRING.INC *)
- (* inc, concates number + string *)
- IF SysLineCnt
- then pLINECOUNT(SysOutLine, SysLineNum);
- (*::: string.inc *)
-
- (* WRITE the file data *)
- IF (SysMarkWrite)
- then writeLn(SysOutFile,SysOutLine);
-
- (* DISPLAY data string *)
- IF (SysDisplay) and (SysMarkWrite)
- then writeln(SysOutLine);
-
- end; (* WHILE not (eof(SysInFile)) do *)
- (*------------------------------------*)
-
- (* KEYWORD.INC application routine *)
- (* appends level(stack) numbers to tail of OutFile *)
- (* level/error audit trail *)
- (* pSysLvlWrite; (*::: SysUtl.INC *)
- (**)
-
- (*---------------------------------*)
- close(SysInFile); (* InFile.CMD *)
- close(SysOutFile); (* OutFile.TXT *)
-
-
- (* LineCnt would produce a un-runnable command file *)
- (* do not allow generated file to become file.CMD *)
- (* else, OK to rename files *)
- IF (not SysLineCnt)
- then
- begin
- (* if SysPgmMod not " " then type is recognized *)
- (* mode must be valid, else leave OutFile as .$$$ *)
- pSysReName(SysIOcheck); (*::: SysUtl.INC *)
- end;
-
- (* KEYWORD application routine *)
- (* Sends level(stack) numbers to video. *)
- (* Has been used nicely to attach extra line on output file. *)
- (* Works with KEYword.INC modules *)
-
- IF SysDisplay then
- begin
-
- (* a useful feature on an earlier version
- (* was to write this line on the tail of the OutFile
- (* producing a audit of the possible structural errors.
- (* See notes in ZinUtl.inc.
- (* *)
-
- IF SysPgmMod = 'DB' then
- begin
- writeln('----------------------------');
- writeln('------- dBASE Levels -------');
- writeln(SPMSL, ':I:',SLI,' :C:',SLC,' :W:',SLW, SPMSR);
- writeln('----------------------------');
- pDelay1;
- end;
-
- (* author traces only the Begin/End counter *)
- (* memvar SLB is the Begin/End counter *)
- IF SysPgmMod = 'TP' then
- begin
- writeln('----------------------------------');
- writeln(SPMSL,'Turbo Pascal : B : ',SLB,SPMSR);
- writeln('----------------------------------');
- pDelay1;
- end;
-
- end; (* if sysdisplay *)
-
- IF SysPgmTrace
- then writeln('--- End Read Loop ---',SysInFileName);
-
- end; (* if SysIOcheck true *)
-
- IF not SysIOcheck
- then writeln('SysIOcheck = ',SysIOcheck);
-
- (*---------------------------*)
-
- end; (* FOR SysInSourceCnt := 1 to SysInSourceMAX *)
- (*------------------------------------------------*)
- (* bottom of count through insource array *)
-
- end; (* IF SysEnableCore *)
-
-
- (*=======> NOT CORE <=======*)
-
- (* IF no parameters entered, *)
- (* then default is documentation / InStructions *)
-
- IF not SysEnableCore
- then pSaySysDoc; (*::: SysDOC.INC *)
-
-
-
- END. (* MAIN *)
-
- (*******************************************************************)
- (*<<<>>>*)